/*    */ package com.zimbra.cs.mailbox.acl;
/*    */ 
/*    */ import com.zimbra.cs.mailbox.Folder;
/*    */ import com.zimbra.cs.mailbox.MailItem;
/*    */ import com.zimbra.cs.mailbox.MailItem.Type;
/*    */ import com.zimbra.cs.mailbox.MailboxListener;
/*    */ import com.zimbra.cs.mailbox.MailboxListener.ChangeNotification;
/*    */ import com.zimbra.cs.session.PendingModifications;
/*    */ import com.zimbra.cs.session.PendingModifications.Change;
/*    */ import com.zimbra.cs.util.Zimbra;
/*    */ import java.util.Collections;
/*    */ import java.util.LinkedHashMap;
/*    */ import java.util.Map;
/*    */ import java.util.Set;
/*    */ import java.util.Timer;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class AclPushListener
/*    */   extends MailboxListener
/*    */ {
/* 33 */   private static final Set<MailItem.Type> registeredTypes = Collections.singleton(MailItem.Type.FOLDER);
/*    */   
/*    */   public Set<MailItem.Type> registerForItemTypes()
/*    */   {
/* 37 */     return registeredTypes;
/*    */   }
/*    */   
/*    */   public void notify(MailboxListener.ChangeNotification notification)
/*    */   {
/* 42 */     boolean runAclPushTask = false;
/* 43 */     if (notification.mods.created != null) {
/* 44 */       for (MailItem created : notification.mods.created.values()) {
/* 45 */         if ((created instanceof Folder)) {
/* 46 */           Folder folder = (Folder)created;
/* 47 */           if (folder.getACL() != null) {
/* 48 */             runAclPushTask = true;
/* 49 */             break;
/*    */           }
/*    */         }
/*    */       }
/*    */     }
/* 54 */     if ((!runAclPushTask) && (notification.mods.modified != null)) {
/* 55 */       for (PendingModifications.Change change : notification.mods.modified.values())
/*    */       {
/* 57 */         if (((change.what instanceof Folder)) && ((change.why & 0x201200) != 0)) {
/* 58 */           runAclPushTask = true;
/* 59 */           break;
/*    */         }
/*    */       }
/*    */     }
/* 63 */     if ((!runAclPushTask) && (notification.mods.deleted != null)) {
/* 64 */       for (PendingModifications.Change change : notification.mods.deleted.values()) {
/* 65 */         if (change.preModifyObj == null) {
/* 66 */           if (change.what == MailItem.Type.FOLDER)
/*    */           {
/* 68 */             runAclPushTask = true;
/* 69 */             break;
/*    */           }
/* 71 */         } else if (((change.preModifyObj instanceof Folder)) && (((Folder)change.preModifyObj).getACL() != null)) {
/* 72 */           runAclPushTask = true;
/* 73 */           break;
/*    */         }
/*    */       }
/*    */     }
/* 77 */     if (runAclPushTask)
/*    */     {
/* 79 */       Zimbra.sTimer.schedule(new AclPushTask(), 0L);
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailbox/acl/AclPushListener.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */